<template>
  <div class="home_wrap">
    <div>
      <van-button @click="goCategory" type="primary">{{ env }}</van-button>
    </div>
    <div v-if="isLimit && env == 'wxwork'">Home</div>
    <div v-if="!isLimit && env == 'wxwork'">当前用户没有权限</div>
    <div v-if="env != 'wxwork'">当前不是企业微信环境</div>
  </div>
</template>

<script>
import { defineComponent, onMounted, ref } from "vue";
import { Button } from "vant";
import router from "@/router";
export default defineComponent({
  name: "Home",
});
</script>
<script setup>
import { isWxWorkEnv } from "@/libs/env.js";

const goCategory = () => {
  router.push({
    path: "/category",
  });
};

const env = ref("");
const envStr = ref("");
const isLimit = ref(false);

onMounted(() => {
  env.value = isWxWorkEnv();
  envStr.value = window.navigator.userAgent.toLowerCase();
});
</script>

<style lang="scss" scoped></style>
